package com.ty.controller;

import com.ty.dao.InventoryDao;
import com.ty.service.InventoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/inventory")
public class inventoryController {

    @Autowired
    private InventoryService inventoryService;

    @RequestMapping("/deduct")
    public Integer deduct(@RequestParam Integer productId,@RequestParam Integer optionQty) {
         try {
             inventoryService.deduct(productId,optionQty);
         }catch (Exception e){
             e.printStackTrace();
         }
         return 0;
    }
}
